Optimal. Leaf size=68 \[ -\frac {\sin (2 a-c+(2 b-d) x)}{4 (2 b-d)}+\frac {\sin (c+d x)}{2 d}-\frac {\sin (2 a+c+(2 b+d) x)}{4 (2 b+d)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 68, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 2, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {4670, 2717}
\begin {gather*} -\frac {\sin (2 a+x (2 b-d)-c)}{4 (2 b-d)}-\frac {\sin (2 a+x (2 b+d)+c)}{4 (2 b+d)}+\frac {\sin (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2717
Rule 4670
Rubi steps
\begin {align*} \int \cos (c+d x) \sin ^2(a+b x) \, dx &=\int \left (-\frac {1}{4} \cos (2 a-c+(2 b-d) x)+\frac {1}{2} \cos (c+d x)-\frac {1}{4} \cos (2 a+c+(2 b+d) x)\right ) \, dx\\ &=-\left (\frac {1}{4} \int \cos (2 a-c+(2 b-d) x) \, dx\right )-\frac {1}{4} \int \cos (2 a+c+(2 b+d) x) \, dx+\frac {1}{2} \int \cos (c+d x) \, dx\\ &=-\frac {\sin (2 a-c+(2 b-d) x)}{4 (2 b-d)}+\frac {\sin (c+d x)}{2 d}-\frac {\sin (2 a+c+(2 b+d) x)}{4 (2 b+d)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.86, size = 76, normalized size = 1.12 \begin {gather*} \frac {1}{4} \left (\frac {2 \cos (d x) \sin (c)}{d}+\frac {2 \cos (c) \sin (d x)}{d}-\frac {\sin (2 a-c+2 b x-d x)}{2 b-d}-\frac {\sin (2 a+c+2 b x+d x)}{2 b+d}\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.23, size = 63, normalized size = 0.93
method | result | size |
default | \(-\frac {\sin \left (2 a -c +\left (2 b -d \right ) x \right )}{4 \left (2 b -d \right )}+\frac {\sin \left (d x +c \right )}{2 d}-\frac {\sin \left (2 a +c +\left (2 b +d \right ) x \right )}{4 \left (2 b +d \right )}\) | \(63\) |
risch | \(\frac {2 \sin \left (d x +c \right ) b^{2}}{d \left (2 b -d \right ) \left (2 b +d \right )}-\frac {d \sin \left (d x +c \right )}{2 \left (2 b -d \right ) \left (2 b +d \right )}-\frac {\sin \left (2 b x -d x +2 a -c \right ) b}{2 \left (2 b -d \right ) \left (2 b +d \right )}-\frac {d \sin \left (2 b x -d x +2 a -c \right )}{4 \left (2 b -d \right ) \left (2 b +d \right )}-\frac {\sin \left (2 b x +d x +2 a +c \right ) b}{2 \left (2 b -d \right ) \left (2 b +d \right )}+\frac {d \sin \left (2 b x +d x +2 a +c \right )}{4 \left (2 b -d \right ) \left (2 b +d \right )}\) | \(191\) |
norman | \(\frac {-\frac {4 b \tan \left (\frac {b x}{2}+\frac {a}{2}\right )}{4 b^{2}-d^{2}}+\frac {4 b \left (\tan ^{3}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )}{4 b^{2}-d^{2}}+\frac {4 b \tan \left (\frac {b x}{2}+\frac {a}{2}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 b^{2}-d^{2}}-\frac {4 b \left (\tan ^{3}\left (\frac {b x}{2}+\frac {a}{2}\right )\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 b^{2}-d^{2}}+\frac {4 b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \left (4 b^{2}-d^{2}\right )}+\frac {4 b^{2} \left (\tan ^{4}\left (\frac {b x}{2}+\frac {a}{2}\right )\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \left (4 b^{2}-d^{2}\right )}+\frac {8 \left (b^{2}-d^{2}\right ) \left (\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \left (4 b^{2}-d^{2}\right )}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (1+\tan ^{2}\left (\frac {b x}{2}+\frac {a}{2}\right )\right )^{2}}\) | \(277\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 371 vs.
\(2 (62) = 124\).
time = 0.29, size = 371, normalized size = 5.46 \begin {gather*} -\frac {{\left (2 \, b d \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \cos \left ({\left (2 \, b + d\right )} x + 2 \, a + 2 \, c\right ) - {\left (2 \, b d \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \cos \left ({\left (2 \, b + d\right )} x + 2 \, a\right ) - {\left (2 \, b d \sin \left (c\right ) + d^{2} \sin \left (c\right )\right )} \cos \left (-{\left (2 \, b - d\right )} x - 2 \, a + 2 \, c\right ) + {\left (2 \, b d \sin \left (c\right ) + d^{2} \sin \left (c\right )\right )} \cos \left (-{\left (2 \, b - d\right )} x - 2 \, a\right ) - 2 \, {\left (4 \, b^{2} \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \cos \left (d x + 2 \, c\right ) + 2 \, {\left (4 \, b^{2} \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \cos \left (d x\right ) - {\left (2 \, b d \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \sin \left ({\left (2 \, b + d\right )} x + 2 \, a + 2 \, c\right ) - {\left (2 \, b d \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \sin \left ({\left (2 \, b + d\right )} x + 2 \, a\right ) + {\left (2 \, b d \cos \left (c\right ) + d^{2} \cos \left (c\right )\right )} \sin \left (-{\left (2 \, b - d\right )} x - 2 \, a + 2 \, c\right ) + {\left (2 \, b d \cos \left (c\right ) + d^{2} \cos \left (c\right )\right )} \sin \left (-{\left (2 \, b - d\right )} x - 2 \, a\right ) + 2 \, {\left (4 \, b^{2} \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \sin \left (d x + 2 \, c\right ) + 2 \, {\left (4 \, b^{2} \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \sin \left (d x\right )}{8 \, {\left ({\left (\cos \left (c\right )^{2} + \sin \left (c\right )^{2}\right )} d^{3} - 4 \, {\left (b^{2} \cos \left (c\right )^{2} + b^{2} \sin \left (c\right )^{2}\right )} d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.62, size = 70, normalized size = 1.03 \begin {gather*} -\frac {2 \, b d \cos \left (b x + a\right ) \cos \left (d x + c\right ) \sin \left (b x + a\right ) - {\left (d^{2} \cos \left (b x + a\right )^{2} + 2 \, b^{2} - d^{2}\right )} \sin \left (d x + c\right )}{4 \, b^{2} d - d^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 410 vs.
\(2 (49) = 98\).
time = 0.79, size = 410, normalized size = 6.03 \begin {gather*} \begin {cases} x \sin ^{2}{\left (a \right )} \cos {\left (c \right )} & \text {for}\: b = 0 \wedge d = 0 \\\frac {x \sin ^{2}{\left (a - \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{4} + \frac {x \sin {\left (a - \frac {d x}{2} \right )} \sin {\left (c + d x \right )} \cos {\left (a - \frac {d x}{2} \right )}}{2} - \frac {x \cos ^{2}{\left (a - \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{4} + \frac {3 \sin {\left (a - \frac {d x}{2} \right )} \cos {\left (a - \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {\sin {\left (c + d x \right )} \cos ^{2}{\left (a - \frac {d x}{2} \right )}}{d} & \text {for}\: b = - \frac {d}{2} \\\frac {x \sin ^{2}{\left (a + \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{4} - \frac {x \sin {\left (a + \frac {d x}{2} \right )} \sin {\left (c + d x \right )} \cos {\left (a + \frac {d x}{2} \right )}}{2} - \frac {x \cos ^{2}{\left (a + \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{4} + \frac {\sin ^{2}{\left (a + \frac {d x}{2} \right )} \sin {\left (c + d x \right )}}{d} + \frac {\sin {\left (a + \frac {d x}{2} \right )} \cos {\left (a + \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: b = \frac {d}{2} \\\left (\frac {x \sin ^{2}{\left (a + b x \right )}}{2} + \frac {x \cos ^{2}{\left (a + b x \right )}}{2} - \frac {\sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{2 b}\right ) \cos {\left (c \right )} & \text {for}\: d = 0 \\\frac {2 b^{2} \sin ^{2}{\left (a + b x \right )} \sin {\left (c + d x \right )}}{4 b^{2} d - d^{3}} + \frac {2 b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (a + b x \right )}}{4 b^{2} d - d^{3}} - \frac {2 b d \sin {\left (a + b x \right )} \cos {\left (a + b x \right )} \cos {\left (c + d x \right )}}{4 b^{2} d - d^{3}} - \frac {d^{2} \sin ^{2}{\left (a + b x \right )} \sin {\left (c + d x \right )}}{4 b^{2} d - d^{3}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.44, size = 61, normalized size = 0.90 \begin {gather*} -\frac {\sin \left (2 \, b x + d x + 2 \, a + c\right )}{4 \, {\left (2 \, b + d\right )}} - \frac {\sin \left (2 \, b x - d x + 2 \, a - c\right )}{4 \, {\left (2 \, b - d\right )}} + \frac {\sin \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.81, size = 105, normalized size = 1.54 \begin {gather*} \frac {\sin \left (c+d\,x\right )}{2\,d}-\frac {b\,\left (2\,d\,\sin \left (2\,a+c+2\,b\,x+d\,x\right )+2\,d\,\sin \left (2\,a-c+2\,b\,x-d\,x\right )\right )-d^2\,\sin \left (2\,a+c+2\,b\,x+d\,x\right )+d^2\,\sin \left (2\,a-c+2\,b\,x-d\,x\right )}{16\,b^2\,d-4\,d^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________